// 服务地址
const url = "https://dongshengbaozhuang.com:31000"
// 引入接口
import http from './httprequest.js'
// 接口API

// 获取openid session_key
export const getOpenIdAndSessionKey = (code) => {
	let param = {
		url: `/aaa/onLogin`,
		params: {
			code
		}
	}
	return http.request(param).then(res => {
		return res
	})
}
export const getUserInfo = (data) => {
	let param = {
		url: `/aaa/deciphering`,
		params: {
			...data
		}
	}
	return http.request(param).then(res => {
		return res
	})
}


// 获取图标
export const getIcon = (code) => {
	let param = {
		url: `/applet/icon/list`,
		params: {
			icPosition: String(code),
			baShow: 0
		}

	}
	return http.request(param).then(res => {
		return res
	})
}
// 获取背景图
export const getBg = (code) => {
	let param = {
		url: `/applet/backdrop/list`,
		params: {
			baPosition: code,
			baShow: 0
		}
	}
	return http.request(param).then(res => {
		return res
	})
}

// 轮播图
export const getSwiper = () => {
	let param = {
		url: `/slideshow/slideshow/list`,
		params: {}
	}
	return http.request(param).then(res => {
		return res
	})
}
// 获取视频
export const getVideo = (code) => {
	let param = {
		url: `/applet/video/list`,
		params: {
			viPlace: code
		}
	}
	return http.request(param).then(res => {
		return res
	})
}
// 观看视频 次数加一
export const getVideoNumAddone = (id) => {
	let param = {
		url: `/applet/video/play`,
		params: {
			id
		}
	}
	return http.request(param).then(res => {
		return res
	})
}

// 品牌推荐
export const getBrand = () => {
	let param = {
		url: `/applet/case/list`,
		params: {}
	}
	return http.request(param).then(res => {
		return res
	})
}


// 质保录入
export const leagueLogin = (params) => {
	let param = {
		url: `/applet/league/list`,
		params
	}
	return http.request(param).then(res => {
		return res
	})
}

// 添加质保信息
export const addleague = (params) => {
	let param = {
		url: `/applet/guarantee`,
		method: "post",
		params
	}
	return http.request(param).then(res => {
		return res
	})
}
// 质保查询
export const getZb = (params) => {
	let param = {
		url: `/applet/guarantee/list`,
		params
	}
	return http.request(param).then(res => {
		return res
	})
}

// 质保查询---根据手机号、车牌号、质保编号等
export const selectZb = (params) => {
	let param = {
		url: `/applet/guarantee/select`,
		params
	}
	return http.request(param).then(res => {
		return res
	})
}

// 案例中心
export const getAl = (code) => {
	let param = {
		url: `/applet/case/list`,
		params: {
			caName: code
		}
	}
	return http.request(param).then(res => {
		return res
	})
}

// 报价查询
export const getMiniSelect = (code) => {
	let param = {
		url: `/applet/productBrand/miniSelect`,
		params: {
			prType: code
		}
	}
	return http.request(param).then(res => {
		return res
	})
}
export const bwList = (code) => {
	let param = {
		url: `/applet/money/list`,
		params: {
			moPrId: code,
			pageNum: 1,
			pageSize: 1000
		}
	}
	return http.request(param).then(res => {
		return res
	})
}

// 商品
export const getDict = () => {
	let param = {
		url: `/applet/model/dictType`,
		params: {
			dictType: 'product_type'
		}
	}
	return http.request(param).then(res => {
		return res
	})
}
// 商品列表
export const getDictList = (code) => {
	let param = {
		url: `/applet/model/dict`,
		params: {
			dictCode: code
		}
	}
	return http.request(param).then(res => {
		return res
	})
}

// 加盟店申请
export const postJmd = (params) => {
	let param = {
		url: `/applet/league`,
		method: "post",
		params
	}
	return http.request(param).then(res => {
		return res
	})
}
// 获取品牌类型
export const getPPLX = (code) => {
	let param = {
		url: `/applet/productBrand/list`,
		params: {
			brShow: code
		}
	}
	return http.request(param).then(res => {
		return res
	})
}
// 获取品牌型号
export const getPpxh = (prBrand) => {
	let param = {
		url: `/applet/model/list`,
		params: prBrand
	}
	return http.request(param).then(res => {
		return res
	})
}
// 获取产品详情
export const getInfoData = (id) => {
	let param = {
		url: `/applet/model/` + id
	}
	return http.request(param).then(res => {
		return res
	})
}

// 获取质保编号
export const getCaseCode = (params) => {
	let param = {
		url: `/applet/guarantee/selectNum`,
		params
	}
	return http.request(param).then(res => {
		return res
	})
}
// 门店查询
export const getStore= () => {
	let param = {
		url: `/applet/league/list`,
		params:{
			pageNum: 1,
			pageSize: 1000
		}
	}
	return http.request(param).then(res => {
		return res
	})
}

// 获取车品牌
export const getCar = (params) => {
	let param = {
		url: `/applet/brand/list`,
		params
	}
	return http.request(param).then(res => {
		return res
	})
}

// 根据id 获取详情

export const getCarList = (id) => {
	let param = {
		url: `/applet/brandModel/list`,
		params: {
			pageNum: 1,
			pageSize: 400,
			brId: id
		}
	}
	return http.request(param).then(res => {
		return res
	})
}